package Testing;

import DeportManage.Customer;
import DeportManage.ErrorFormatNameException;
import DeportManage.Name;
import DeportManage.NotFormatParcelIDException;

import org.junit.*;
import static org.junit.Assert.*;

public class CustomerTest {
	
	/**
	 * Method to test the Customer
	 * Example taken is name: Madiha Jami and ID:C5607 with sequence no. 2
	 */
	@Test
	public void testCustomer() throws ErrorFormatNameException, NotFormatParcelIDException{
		
		int sequenceNo = 2;
		Name name = new Name("Madiha Jami");
		//String name = "Madiha Jami";
		String id_parcel = "C5607";
		//String message_a = "Failed due to invalid Customer Inputs";
		try {
		Customer customer = new Customer(sequenceNo,name,id_parcel);
		}
		catch (IllegalArgumentException e)
		{
		assertTrue(e.getMessage().contains("C5607"));
		}
	}

	/**
	 * Method to test the Name of  the Customer
	 * Example taken is name: Madiha Jami 
	 *	getFullName() method is used to get the name of the Customer
	 */
	@Test
	public void testCustomerName() throws ErrorFormatNameException{
		
		String expected_Name = "Madiha Jami";
		String message_a = "Failed for incompatible name format: Should be 'Madiha Jami'";		
		Name name = new Name("Madiha Jami");
		String actuall_a = name.getFullName();
		assertEquals(message_a, expected_Name, actuall_a);
	}
	
	/**
	 * Method to test the Sequence Number of the Customers
	 * Example taken is name: Madiha Jami and ID:C5607 
	 * With expected sequence no. 24 
	 */
	@Test
	public void testCustomerSequenceNo() throws ErrorFormatNameException, NotFormatParcelIDException{
		int expected_sequence_No=24;
		int Customer_SequenceNumber = 24;
		Name name = new Name("Madiha Jami");
		String id_parcel = "C5607";
		Customer customer = new Customer(Customer_SequenceNumber,name,id_parcel);
		Customer_SequenceNumber= customer.getSequenceNo();
		
		String message_a="Sequence Number Matched Thumbs Up";
		assertEquals(message_a, expected_sequence_No, Customer_SequenceNumber);
		
	}

	/**
	 * Method to test the Parcel Id of the Customer
	 * Customer Sequence no. provided is 24
	 * Name: Madiha Jami and ID:C5607 is given as an example
	 */
	@Test
	public void testCustomerParcelID() throws NotFormatParcelIDException, ErrorFormatNameException{

		String expected_ParcelID="C5607";
		int Customer_SequenceNumber = 24;
		String Customer_ParcelID = "C5607";
		Name name = new Name("Madiha Jami");
		Customer customer = new Customer(Customer_SequenceNumber,name,Customer_ParcelID);
		Customer_ParcelID= customer.getParcelID();
		
		String message_a="Parcel ID Matched Thumbs Up";
		assertEquals(message_a, expected_ParcelID, Customer_ParcelID);		
	}
}
